<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>Tables - Ace Admin</title>

<meta name="description" content="Static &amp; Dynamic Tables" />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<!-- bootstrap & fontawesome -->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/font-awesome.min.css" />
<!-- page specific plugin styles -->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/jquery-ui.custom.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/chosen.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-datepicker3.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-timepicker.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/daterangepicker.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-colorpicker.min.css" />

<!-- ace styles -->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/ace.min.css"
	id="main-ace-style" />

<!--[if lte IE 9]>
			<link rel="stylesheet" href="<%=request.getContextPath()%>/ace/assets/css/ace-part2.min.css" />
		<![endif]-->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/ace-skins.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/ace-rtl.min.css" />

<!--[if lte IE 9]>
		  <link rel="stylesheet" href="<%=request.getContextPath()%>/ace/assets/css/ace-ie.min.css" />
		<![endif]-->

<!-- inline styles related to this page -->

<!-- ace settings handler -->
<script
	src="<%=request.getContextPath()%>/ace/assets/js/ace-extra.min.js"></script>

<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

<!--[if lte IE 8]>
		<script src="<%=request.getContextPath()%>/ace/assets/js/html5shiv.min.js"></script>
		<script src="<%=request.getContextPath()%>/ace/assets/js/respond.min.js"></script>
		<![endif]-->
</head>

<body class="no-skin">


	<div class="page-content">
		<!-- /section:settings.box -->
		<div class="page-content-area">
			<div class="row">
				<div class="col-xs-12">
					<!-- PAGE CONTENT BEGINS -->
					<div class="row">
						<div class="col-xs-12">
							<div class="table-header">悬赏列表</div>

							<!-- <div class="dataTables_borderWrap"> -->
							<div>
								<div id="sample-table-2_wrapper"
									class="dataTables_wrapper form-inline no-footer">
									<form action="<%=request.getContextPath()%>/bsbRapid/list.do"
										method="get" id="drizzt-table">
										<div class="row">
											<div class="col-xs-12">
												<div class="input-group input-group-sm">
														<span class="input-group-addon">
															问题内容
														</span>
														<input type="text" placeholder="问题内容" name="question" value="${question }"  class="form-control" />
														
													</div>
													<div class="input-group input-group-sm">
														<span class="input-group-addon">
															所属机构
														</span>
														<input type="text" placeholder="所属机构" name="firm" value="${firm}"  class="form-control" />
														
													</div>
													<div class="input-group input-group-sm">
														<span class="input-group-addon">
															商品ID
														</span>
														<input type="text" placeholder="商品ID" name="uuid" value="${uuid}"  class="form-control" />
														
													</div>
													<div class="input-group input-group-sm">
														<span class="input-group-addon">
															提问人
														</span>
														<input type="text" placeholder="提问人" name="qname" value="${qname }"  class="form-control" />
													</div>
													<div class="input-group input-group-sm">
												            <span class="input-group-addon">采纳状态</span>
												            <select class="form-control" name="status">
														      <option value="">全部</option>
														      <option value="0" <c:if test="${status=='0' }">selected</c:if> >未采纳</option>
														      <option value="1" <c:if test="${status=='1' }">selected</c:if> >已采纳</option>
														    </select>
														
													</div>
														<div class="input-group input-group-sm">
															<span class="input-group-addon">
																回答人
															</span>
															<input type="text" placeholder="回答人" name="aname" value="${aname }"  class="form-control" />
														</div>
														
													
													<div class="input-group input-group-sm">
											        	<span class="input-group-addon">提问日期</span>
														<div class="input-daterange" data-date-format="yyyy-mm-dd" id="datepicker">
														    <input type="text" class="input-sm form-control" name="start" value="${start }"/>
														    <span>-</span>
														    <input type="text" class="input-sm form-control" name="end" value="${end }"/>
														</div>
											        </div>
													<div class="input-group input-group-sm">
														<button type="button" onclick="search()" class="btn btn-purple btn-sm">
															<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
															搜索
														</button>
													</div>
											</div>
										</div>
										<table 
											class="table table-striped table-bordered table-hover dataTable no-footer"
											id="sample-table-2" role="grid"
											aria-describedby="sample-table-2_info">
											<thead>
												<tr role="row">
														<th class="sorting_disabled">商品ID</th>
														<th class="sorting_disabled">提问人</th>
														<th class="sorting_disabled">问题内容</th>
														<th class="sorting_disabled">提问日期</th>
														<th class="sorting_disabled">采纳状态</th>
														<th class="sorting_disabled">回答人</th>
														<th class="sorting_disabled">回答日期</th>
														<th class="sorting_disabled">采纳人</th>
														<th class="sorting_disabled">采纳人所属机构</th>
														<th class="sorting_disabled">金额</th>
													<th class="sorting_disabled">操作</th>
												</tr>
											</thead>

											<tbody>
												<c:forEach items="${bsbRapids}" var="bsbRapid">
													<tr role="row" class="odd">
															<td>${bsbRapid.uuid}</td>
															<td>${bsbRapid.qusername}</td>
															<td>${bsbRapid.content}</td>
															<td><fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${bsbRapid.createDate}" /></td>
															<td>${bsbRapid.status=='0'?'未采纳':bsbRapid.status=='1'?'已采纳':bsbRapid.status=='2'?'过期退钱':bsbRapid.status=='3'?'过期分钱':'未知'}</td>
															<td><c:forEach items="${bsbRapid.answerLists}" var="ansuser">
																	${ansuser.cusername }<br>
																</c:forEach></td>
															<td><c:forEach items="${bsbRapid.answerLists}" var="ansuser">
																	<fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${ansuser.answerDate }" /><br>
																</c:forEach></td>
															<td>${bsbRapid.adoptusername}</td>
															<td>${bsbRapid.adoptuserdept}</td>
															<td class="yellow">${bsbRapid.price}</td>
														<td>
										                    <shiro:hasPermission name="bsbRapid:view">
										                        <a class="blue"  href="<%=request.getContextPath()%>/bsbRapid/${bsbRapid.uuid}/view">
																	<i class="ace-icon fa fa-search-plus bigger-130"></i>查看
																</a>
										                    </shiro:hasPermission>
										                   
										                </td>
													</tr>
												</c:forEach>
											</tbody>
										</table>
										<div class="row">
											<div class="col-xs-6">
												<div class="dataTables_info" id="sample-table-2_info"
													role="status" aria-live="polite">
													共 ${totalCount} 条数据，当前第<input type="text" id="pageNum"
														name="pageNum" style="width: 40px;" value="${pageNum}" />页&nbsp;&nbsp;
													<input type="button" class="btn btn-sm btn-primary" onclick="goPage($('#pageNum').val())" value="跳转"></input>
												</div>
											</div>
											<div class="col-xs-6">
												<div class="dataTables_paginate paging_simple_numbers"
													id="sample-table-2_paginate">
													<ul class="pagination">
														<li class="paginate_button <c:if test="${pageNum==1}">disabled</c:if>"
															aria-controls="sample-table-2" tabindex="0"
															id="sample-table-2_previous"><a href="javascript:void(0)"
															onclick="goPage(1)">首页</a></li>
														<li class="paginate_button <c:if test="${pageNum==1}">disabled</c:if>"
															aria-controls="sample-table-2" tabindex="0"
															id="sample-table-2_previous"><a href="javascript:void(0)"
															onclick="goPage(${pageNum}-1)">上一页</a></li>
														<li class="paginate_button <c:if test="${pageNum==maxPageNum}">disabled</c:if>" aria-controls="sample-table-2"
															tabindex="0" id="sample-table-2_previous"><a
															href="javascript:void(0)" onclick="goPage(${pageNum}+1)">下一页</a></li>
														<li class="paginate_button <c:if test="${pageNum==maxPageNum}">disabled</c:if>" aria-controls="sample-table-2"
															tabindex="0" id="sample-table-2_previous"><a
															href="javascript:void(0)" onclick="goPage(${maxPageNum})">尾页</a></li>
													</ul>
												</div>
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
					<!-- PAGE CONTENT ENDS -->
				</div>
				<!-- /.col -->
			</div>
			<!-- /.row -->
		</div>
		<!-- /.page-content-area -->
	</div>

</body>

<!-- basic scripts -->

<!--[if !IE]> -->
<script type="text/javascript">
	window.jQuery
			|| document
					.write("<script src='<%=request.getContextPath()%>/ace/assets/js/jquery.min.js'>"
							+ "<"+"/script>");
</script>

<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='<%=request.getContextPath()%>/ace/assets/js/jquery1x.min.js'>"+"<"+"/script>");
</script>
<![endif]-->
<script type="text/javascript">
	if ('ontouchstart' in document.documentElement)
		document.write("<script src='<%=request.getContextPath()%>/ace/assets/js/jquery.mobile.custom.min.js'>"+ "<"+"/script>");
</script>

<script type="text/javascript">
	function goPage(pageNum){
		if(${pageNum}==1 && pageNum<=1){
			return false;
		}
		if(${pageNum==maxPageNum} && pageNum>=${maxPageNum}){
			return false;
		}
		if(pageNum!=0){
			$("#pageNum").val(pageNum);
		}
		var myreg=/^[0-9]*$/;
		if(!myreg.test($("#pageNum").val())){
			alert("请输入有效数字！");
			$("#pageNum").val(1);
			return false;
		}
		$("#drizzt-table").submit();
	}
	
	function goOperate(operate,uuid){
		if(operate=="add"){
			$("#drizzt-table").attr("action", "<%=request.getContextPath()%>/bsbRapid/toAdd.do");
			$("#drizzt-table").submit();
		}
		if(operate=="edit"){
			//var val=$("#uuid:checked").val();
			if(val==null){
                alert("请选择一条数据");
                return false;
            }else{
				$("#drizzt-table").attr("action", "<%=request.getContextPath()%>/bsbRapid/toEdit.do");
				$("#drizzt-table").submit();
            }
		}
		if(operate=="del"){
			var val=$("#uuid:checked").val();
			if(val==null){
                alert("请选择一条数据");
                return false;
            }else{
            	if(confirm("确定要删除该信息吗？删除将不能恢复！")){
            		$("#drizzt-table").attr("action", "<%=request.getContextPath()%>/bsbRapid/del.do");
     				$("#drizzt-table").submit();
            	}else{
            		return false;
            	}
            }
		}
		if(operate=="view"){
			var val=$("#uuid:checked").val();
			if(val==null){
                alert("请选择一条数据");
                return false;
            }else{
				$("#drizzt-table").attr("action", "<%=request.getContextPath()%>/bsbRapid/view.do");
				$("#drizzt-table").submit();
            }
		}
	}
</script>
<script
	src="<%=request.getContextPath()%>/ace/assets/js/bootstrap.min.js"></script>
<script
	src="<%=request.getContextPath()%>/ace/assets/js/bootstrap-datepicker.min.js"></script>
<script
	src="<%=request.getContextPath()%>/ace/assets/locales/bootstrap-datepicker.zh-CN.min.js"></script>
	
<script type="text/javascript">
jQuery(function($) {
	$("#datepicker").datepicker({
		dateFormat: "yy-mm-dd",
	    todayBtn: "linked",
	    clearBtn: true,
	    language: "zh-CN",
	    autoclose: true,
	    todayHighlight: true
	});
	
})

function search(){
	$("#drizzt-table").submit();
}
</script>
</html>
